# $Id: PKGBUILD 85897 2013-03-08 16:40:25Z lcarlier $
# Maintainer: Laurent Carlier <lordheavym@gmail.com>
# Contributor: Jaroslaw Swierczynski <swiergot@aur.archlinux.org>
# Contributor: Roman Kyrylych <Roman.Kyrylych@gmail.com>
# Contributor: Christoph Siegenthaler <csi@gmx.ch>
# Contributor: Jesse Young <jesse@eon.jlyo.org>

pkgname=sauerbraten
pkgver=2013_02_03_collect_edition
pkgrel=1
pkgdesc="FPS that uses an improved version of the Cube engine"
arch=('i686' 'x86_64')
url="http://www.sauerbraten.org/"
license=('ZLIB')
makedepends=('sdl_mixer' 'sdl_image' 'mesa-libgl' 'glu' 'gendesk')
install=sauerbraten.install
backup=('etc/conf.d/sauerbraten')
source=(http://downloads.sourceforge.net/$pkgname/${pkgname}_${pkgver}_linux.tar.bz2
	sauerbraten-client
	sauerbraten-server
	sauerbraten.confd
	sauerbraten.png
	sauerbraten.install
	sauerbraten.service
	license.txt)
md5sums=('2cfbd619981402898f97b93be08d58ac'
         'cb84f0baa72ad88b939a9e5fd0916559'
         '4a42c314d01ccdc4c76fad38d18c7434'
         'c28be8761ede9ca82b6ab311aa7f6d42'
         '3e602f421f7342cf8c3ed16314523d6f'
         '2f7b423f49491359ff776a91414db4d8'
         '3c964cdd0906461c0404641b1eb52d96'
         'cf46cd0148f03b7477f7c54aec865abe')
_exec=('sauerbraten-client %u')

build() {
  cd "$srcdir"
  gendesk
  
  cd "$pkgname/src"

  make
}

package() {
  depends=('sdl_mixer' 'sdl_image' 'libgl' 'sauerbraten-data')

  cd ${srcdir}/$pkgname/src

  make DESTDIR="${pkgdir}" install

  cd ..
  install -D bin_unix/native_client ${pkgdir}/opt/sauerbraten/bin/linux_client
  install -D bin_unix/native_server ${pkgdir}/opt/sauerbraten/bin/linux_server

  install -Dm755 ${srcdir}/sauerbraten-client ${pkgdir}/usr/bin/sauerbraten-client
  install -Dm755 ${srcdir}/sauerbraten-server ${pkgdir}/usr/sbin/sauerbraten-server
  install -Dm644 ${srcdir}/sauerbraten.confd ${pkgdir}/etc/conf.d/sauerbraten
  install -Dm644 ${srcdir}/sauerbraten.service ${pkgdir}/usr/lib/systemd/system/sauerbraten.service
  install -Dm644 ${srcdir}/sauerbraten.desktop ${pkgdir}/usr/share/applications/sauerbraten.desktop
  install -Dm644 ${srcdir}/sauerbraten.png ${pkgdir}/usr/share/pixmaps/sauerbraten.png
  install -Dm644 ${srcdir}/license.txt ${pkgdir}/usr/share/licenses/sauerbraten/license.txt
}
